<?php
/**
 * Core_Model_Insertdata
 * 
 * @author Adrian Stolarski
 */
class Core_Model_Insertdata implements Core_Model_Ormable {
    
    public $database_validation;
    
    public function main(array $variables = null, $table = null, $action = null, $where = '1') {
        $query = "INSERT INTO `$table` ";
        $value = "";
        $notification = "";
        foreach ($variables as $key => $value){
            $notification .= "`$key`, ";
            $this->validation_method($value);
        }
        $query .= "(".rtrim($notification, ', ') ." VALUES (".rtrim($value, ', ') . ");";
        return $query;
    }
    
    private function validation_method($value = null){
        $this->database_validation = new Core_Model_Databasevalidation;
        return $this->database_validation->render($value);
    }

}
